package com.loveprogrammer.eternity.skill.support.skills.monster;

import com.loveprogrammer.eternity.model.Character;
import com.loveprogrammer.eternity.common.Tuple;
import com.loveprogrammer.eternity.skill.support.skills.AbstractPassiveAuraSkill;
import com.loveprogrammer.eternity.skill.support.states.TreatmentState;

import java.util.ArrayList;
import java.util.List;

/**
 * @version 1.0.0
 * @description: 邪恶光环 增加生命恢复速度 ｜ 力量
 * @author: eric
 * @date: 2022-08-22 18:07
 **/
public class UnholyAuraSkill extends AbstractPassiveAuraSkill {

    private int increment;

    public UnholyAuraSkill(int id, int baseInterval, int level, int order, int maxLevel, String name, String desc) {
        super(id, baseInterval, level, order, maxLevel, name, desc);
    }

    @Override
    protected Tuple<String, List<Character>> skillLaunch(Character character,
                                                         List<? extends Character> attack,
                                                         List<? extends Character> defences) {
        Tuple<String, List<Character>> result = new Tuple<>();
        // 进攻方提升力量、技巧
        increment = getHarm(character);
        for (Character member : attack) {
            member.setStrength(member.getStrength() + increment);
            TreatmentState treatmentState = new TreatmentState(member, defences, increment/3);
            setTimeTask(treatmentState, 180);
        }
        result.setKey(character.getName() + "释放了技能【" + getName() + " (" + getLevel() + "级)】，所有友方角色力量提升"
                + increment + "点，每秒恢复生命值" + increment/3 + "点" );
        result.setValue(new ArrayList<>());
        return result;
    }

    @Override
    protected int computeHarm(Character character) {
        return (int) (character.getTechnique() * 0.2 + getLevel() * 50);
    }

    @Override
    protected int computeSecondHarm(Character character) {
        return 0;
    }

    @Override
    public boolean checkLevelUp(int characterLevel) {
        // 每4级升一级
        if(characterLevel % 4 == 0){
            return true;
        }
        return false;
    }

    @Override
    public int defaultHarm() {
        return 0;
    }

    @Override
    public void release(Character character,List<? extends Character> attack, List<? extends Character> defences) {
        for (Character member : attack) {
            member.setStrength(member.getStrength() - increment);
        }
    }

}
